var a = require("../../../@babel/runtime/helpers/toConsumableArray"), t = getApp().globalData.api;

Page({
    data: {
        isSearch: !1,
        isSearchEnd: !1,
        searchValue: "",
        hotCategoryList: [],
        listData: null
    },
    onLoad: function(a) {},
    loadData: function() {
        this.requestPkgData(1);
    },
    requestPkgData: function(e) {
        var o = this, s = {
            pageNum: e, 
            areacode: getApp().globalData.selectedCityAreaCode,
            requestParamsUrl: "",
            orderByUrl: "",
            keyword: 0 != o.data.searchValue.length ? o.data.searchValue : ""
        };
        t.post1("wechat/home/_findmicropackagelist", s, !1).then(function(t) {
            if ("SUCCESS" == t.result) {
                var e = o.data.listData;
                1 == t.values.pageNum ? (wx.pageScrollTo({
                    scrollTop: 9999,
                    duration: 300
                }), e = t.values) : (e.list = [].concat(a(o.data.listData.list), a(t.values.list)), 
                e.pageNum = t.values.pageNum, e.total = t.values.total), o.setData({
                    isSearch: !0,
                    loadingExit: e.list.length >= t.values.total,
                    listData: e
                });
            }
        }, function(a) {});
    },
    searchValueInput: function(a) {
        var t = a.detail.value;
        t.length > 0 ? (this.setData({
            searchValue: t
        }), this.loadData()) : this.setData({
            searchValue: "",
            isSearch: !1,
            listData: null
        });
    },
    searchTap: function() {
        0 != this.data.searchValue.length && this.loadData();
    },
    searchCleanTap: function() {
        this.setData({
            searchValue: "",
            isSearch: !1,
            listData: null
        });
    },
    packageDetailTap: function(a) {
        var t = a.currentTarget.dataset.pkginfo, e = "";
        e = t.hasOwnProperty("sourceId") ? t.hospital.domain + "-combo-" + t.sourceId : t.hospital.domain + "-combo-n" + t.id, 
        wx.navigateTo({
            url: "/pages/packagedetails/packagedetails?oid=".concat(t.id, "&areacode=").concat(t.hospital.areacode)
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});